import http from '@/api/http';

// 获取库存项目列表
export function fetchItemList(params) {
  return http.get('/api/app/stocks/item-list', { params }).then(res => res.data);
}

// 获取所有库存项目列表
export function fetchAllItemList() {
  return http.get('/api/app/stocks/all-item-list').then(res => res.data);
}

// 获取更新的库存项目列表
export function fetchAllUpdatedItemList(params) {
  return http.get('/api/app/stocks/all-updated-item-list', { params }).then(res => res.data);
}

// 获取单个库存项目
export function fetchItem(params) {
  return http.get('/api/app/stocks/item', { params }).then(res => res.data);
}

// 标记使用
export function markUsage(data) {
  return http.post('/api/app/stocks/mark-usage', data);
}

// 后台标记使用
export function markUsageBackgroundRun(data) {
  return http.post('/api/app/stocks/mark-usage-background-run', data);
}

// 报告损坏
export function reportDamage(data) {
  return http.post('/api/app/stocks/report-demage', data);
}

// 后台报告损坏
export function reportDamageBackgroundRun(data) {
  return http.post('/api/app/stocks/report-demage-background-run', data);
}

// 获取可转移站点
export function fetchRelocToSites() {
  return http.get('/api/app/stocks/reloc-to-sites').then(res => res.data);
}

// 转移请求
export function relocRequest(data) {
  return http.post('/api/app/stocks/reloc-request', data);
}

// 获取待处理转移数量
export function fetchRelocPendingCount() {
  return http.get('/api/app/stocks/reloc-pending-count').then(res => res.data);
}

// 获取待处理转移列表
export function fetchRelocPending() {
  return http.get('/api/app/stocks/reloc-pending').then(res => res.data);
}

// 取消待处理转移
export function relocPendingCancel(data) {
  return http.post('/api/app/stocks/reloc-pending-cancel', data);
}

// 批准转移
export function relocApprove(data) {
  return http.post('/api/app/stocks/reloc-approve', data);
}

// 获取未接收转移数量
export function fetchRelocNonRecCount() {
  return http.get('/api/app/stocks/reloc-non-rec-count').then(res => res.data);
}

// 获取未接收转移列表
export function fetchRelocNonRec() {
  return http.get('/api/app/stocks/reloc-non-rec').then(res => res.data);
}

// 接收转移
export function relocReceive(data) {
  return http.post('/api/app/stocks/reloc-receive', data);
}

// 后台接收转移
export function relocReceiveBackgroundRun(data) {
  return http.post('/api/app/stocks/reloc-receive-background-run', data);
} 